package org.jeecg.modules.demo.mes.entity;

import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * @Description: 原料规则表
 * @Author: jeecg-boot
 * @Date:   2023-01-14
 * @Version: V1.0
 */
@Data
@TableName("camellia_mes_material_rule")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="camellia_mes_material_rule对象", description="原料规则表")
public class CamelliaMesMaterialRule implements Serializable {
    private static final long serialVersionUID = 1L;

	/**主键*/
	@TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "主键")
    private String id;
	/**创建人*/
    @ApiModelProperty(value = "创建人")
    private String createBy;
	/**创建日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建日期")
    private Date createTime;
	/**更新人*/
    @ApiModelProperty(value = "更新人")
    private String updateBy;
	/**更新日期*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期")
    private Date updateTime;
	/**工艺名称*/
	@Excel(name = "工艺名称", width = 15, dictTable = "camellia_mes_process_craft", dicText = "craft_name", dicCode = "id")
	@Dict(dictTable = "camellia_mes_process_craft", dicText = "craft_name", dicCode = "id")
    @ApiModelProperty(value = "工艺名称")
    private String craftName;
	/**原料名称*/
	@Excel(name = "原料名称", width = 15)
    @ApiModelProperty(value = "原料名称")
    private String materialName;
	/**供应商*/
	@Excel(name = "供应商", width = 15)
    @ApiModelProperty(value = "供应商")
    private String supplier;
	/**等级*/
	@Excel(name = "等级", width = 15,dicCode = "material_grade")
    @Dict(dicCode = "material_grade")
    @ApiModelProperty(value = "等级")
    private String grade;
	/**产地*/
	@Excel(name = "产地", width = 15)
    @ApiModelProperty(value = "产地")
    private String originPlace;
	/**产品原料比*/
	@Excel(name = "产品原料比", width = 15)
    @ApiModelProperty(value = "产品原料比")
    private Double productMaterialRatio;
	/**水分上限（%）*/
	@Excel(name = "水分上限（%）", width = 15)
    @ApiModelProperty(value = "水分上限（%）")
    private Double wetUp;
	/**水分下限（%）*/
	@Excel(name = "水分下限（%）", width = 15)
    @ApiModelProperty(value = "水分下限（%）")
    private Double wetDown;
	/**is_enable*/
	@Excel(name = "is_enable", width = 15)
    private transient String isEnableString;

    private byte[] isEnable;

    public byte[] getIsEnable(){
        if(isEnableString==null){
            return null;
        }
        try {
            return isEnableString.getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return null;
    }

    public String getIsEnableString(){
        if(isEnable==null || isEnable.length==0){
            return "";
        }
        try {
            return new String(isEnable,"UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return "";
    }
}
